/**
 * @name  AutoRegistryComponents
 * @description  自动按需引入组件
 */
import { AntDesignVueResolver, VueUseComponentsResolver } from 'unplugin-vue-components/resolvers';
import Components from 'unplugin-vue-components/vite';

export default () => {
	return Components({
		// 自定义组件目录
		dirs: ['src/components'],
		extensions: ['vue'],
		deep: true,
		//  声明文件存放目录
		dts: 'types/components.d.ts',
		directoryAsNamespace: false,
		globalNamespaces: [],
		directives: true,
		importPathTransform: (v) => v,
		allowOverrides: false,
		include: [/\.vue$/, /\.vue\?vue/],
		exclude: [/[\\/]node_modules[\\/]/, /[\\/]\.git[\\/]/, /[\\/]\.nuxt[\\/]/],
		resolvers: [
			VueUseComponentsResolver(),
			AntDesignVueResolver({
				importStyle: false, // css in js
			}),
		],
	});
};
